package org.learn.test;

public class HomeWork11 {
    public static void main(String[] args) {
        Cale cale = new Cale(10,0);
        System.out.println("和=" + cale.sum());
        System.out.println("差=" + cale.minus());
        System.out.println("积=" + cale.mul());
        System.out.println("商=" + cale.div());
    }
}
class Cale{
    double num1;
    double num2;
    public Cale(double num1, double num2){
        this.num1 = num1;
        this.num2 = num2;
    }
    //和
    public double sum(){
        return num1 + num2;
    }
    //差
    public double minus(){
        return num1 - num2;
    }
    //积
    public double mul(){
        return num1 * num2;
    }
    //商
    public Double div() {
        //判断
        if (num2 == 0) {
            System.out.println("不能为零");
            return null;
        } else {
            return num1 / num2;
        }
    }
}